package com.apabi.service.impl;

import com.apabi.dao.DownloadsDao;
import com.apabi.model.Downloads;
import com.apabi.service.DownloadsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by huhu on 2018/1/13.
 */
@Service
@Transactional
public class DownloadsServiceImpl implements DownloadsService {

    @Autowired
    private DownloadsDao downloadsDao;

    @Override
    public Page<Downloads> findByUserId(Integer id, Pageable pageable) {
        return downloadsDao.findByUserId(id,pageable);
    }

    @Override
    public void deleteByUserId(Integer id) {
        downloadsDao.deleteByUserId(id);
    }

    @Override
    public void deleteByIdAndUserId(Integer id, Integer userId) {
        downloadsDao.deleteByIdAndUserId(id, userId);
    }
}
